package com.authine.cloudpivot.ext.domain.impl;

import com.authine.cloudpivot.ext.conf.ApplicationConf;
import com.authine.cloudpivot.ext.util.BoServiceUtils;
import com.authine.hermes.app.launcher.service.BOService;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @program: gm-market
 * @description:
 * @author: wlw
 * @create: 2021-08-20 19:24
 **/
@AllArgsConstructor
@NoArgsConstructor
public class CreateOrderTransactionCallbackImpl implements TransactionCallback<Boolean> {
    private List<Map<String, Object>> supplierOrderList ;
    private List<Map<String, Object>> supplierOrderGoodsList ;
    private List<Map<String, Object>> customerOrderGoodsList;
    private Map<String, Object> customerOrder;

    @Override
    public Boolean doInTransaction(TransactionStatus transactionStatus) {
        BoServiceUtils.createBo( ApplicationConf.CUSTOMERORDER,customerOrder);
        BoServiceUtils.batchCreateBo( ApplicationConf.SUPPLIERORDER,supplierOrderList);
        BoServiceUtils.batchCreateBo(ApplicationConf.SUPPLIER_ORDER_GOODS,supplierOrderGoodsList);
        BoServiceUtils.batchCreateBo(ApplicationConf.CUSTOMER_ORDER_GOODS,customerOrderGoodsList);
        return Boolean.TRUE;
    }
}
